package com.sayimo.maker.activity.service.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import com.sayimo.framework.exception.DaoException;
import com.sayimo.framework.exception.ServiceException;
import com.sayimo.maker.activity.dao.BaseSeckillDao;
import com.sayimo.maker.activity.service.BaseSeckillService;
import com.sayimo.maker.commons.Constant;


/**
 * @Copyright (c) 2016 广东省尚一互联网有限公司
 * @Project: schoolmallapi-2.0
 * @ClassName: BaseSeckillServiceImpl.java
 * @Description: 秒抢活动
 * @Author:	tanxin
 * @Date:2016年10月6日,下午3:11:07
 * @Version 1.0.0
 */
@Service(value="baseSeckillService")
public class BaseSeckillServiceImpl implements BaseSeckillService{
	
	@Autowired
	private BaseSeckillDao baseSeckillDao;
	
	/**
	 * 根据标示符查询活动信息
	 */
	@Override
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public Map selectBaseSeckillIdentifier(String identifier)
			throws ServiceException {
		Map resultMap = new HashMap();
		if(StringUtils.isEmpty(identifier)){//参数错误
			resultMap.put(Constant.STATUS, Constant.STATUS_ERROR);
			resultMap.put(Constant.ERROR, Constant.SYSTEM_REQUEST_PARAM_ERROR);
			return resultMap;
		}
		Map map=new HashMap();
		try {
			map=baseSeckillDao.selectBaseSeckillIdentifier(identifier);
			resultMap.put(Constant.DATA, map);
			resultMap.put(Constant.STATUS, Constant.STATUS_SUCCESS);
		} catch (DaoException e) {
			e.printStackTrace();
		}
		return resultMap;
	}

}
